<?php
 class DBConnection{
 	private $dbconn = NULL;
 
 	public function __construct($dbc){
		$this->dbconn = new mysqli($dbc->m_host, $dbc->m_user, $dbc->m_pass, $dbc->m_db);
		$this->dbconn->set_charset("utf8");
	}
	
	public function prepare($sql){
		$stmt = $this->dbconn->prepare($sql);
		if($stmt === FALSE){
			throw new Exception($this->dbconn->error);
		}
		return $stmt;
	}
	
	public function execute($stmt){
		$stmt->execute();
		$stmt->store_result();
		$rows = $stmt->num_rows;
		$stmt->close();
		
		return $rows;
	}
	
	public function close(){
		return $this->dbconn->close();
	}
	
 }
?>